39325eb9b60a7fa61a86dbc1558d95cc80b95031,opennms-install/src/main/java/org/opennms/install/Installer.java,Installer,copyFile,#String#String#String#boolean#,591
Before Change
if (!sourceFile.canRead()) { throw new Exception("source file (" + source + ") is not readable!"); }
if (destinationFile.exists()) {
m_out.print(" - " + destination + " exists, removing... ");
destinationFile.delete();
m_out.println("REMOVED");
}
m_out.print(" - copying " + source + " to " + destination + "... ");
if (!destinationFile.getParentFile().exists()) {
destinationFile.getParentFile().mkdirs();
}
destinationFile.createNewFile();
FileChannel from = null;
FileChannel to = null;
try {
After Change
}
if (destinationFile.exists()) {
m_out.print(" - " + destination + " exists, removing... ");
if (destinationFile.delete()) {
m_out.println("REMOVED");
} else {
m_out.println("FAILED");
throw new Exception("unable to delete existing file: "
+ sourceFile);
}
}
m_out.print(" - copying " + source + " to " + destination + "... ");
if (!destinationFile.getParentFile().exists()) {
destinationFile.getParentFile().mkdirs();
}
if (!destinationFile.createNewFile()) {
throw new Exception("unable to create file: " + destinationFile);
}
FileChannel from = null;
FileChannel to = null;